﻿#region Copyright (c) 2000-2008 Developer Express Inc.
/*
{*******************************************************************}
{                                                                   }
{       Developer Express .NET Component Library                    }
{       AgDataGrid                                 }
{                                                                   }
{       Copyright (c) 2000-2008 Developer Express Inc.              }
{       ALL RIGHTS RESERVED                                         }
{                                                                   }
{   The entire contents of this file is protected by U.S. and       }
{   International Copyright Laws. Unauthorized reproduction,        }
{   reverse-engineering, and distribution of all or any portion of  }
{   the code contained in this file is strictly prohibited and may  }
{   result in severe civil and criminal penalties and will be       }
{   prosecuted to the maximum extent possible under the law.        }
{                                                                   }
{   RESTRICTIONS                                                    }
{                                                                   }
{   THIS SOURCE CODE AND ALL RESULTING INTERMEDIATE FILES           }
{   ARE CONFIDENTIAL AND PROPRIETARY TRADE                          }
{   SECRETS OF DEVELOPER EXPRESS INC. THE REGISTERED DEVELOPER IS   }
{   LICENSED TO DISTRIBUTE THE PRODUCT AND ALL ACCOMPANYING .NET    }
{   CONTROLS AS PART OF AN EXECUTABLE PROGRAM ONLY.                 }
{                                                                   }
{   THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED      }
{   FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE        }
{   COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE       }
{   AVAILABLE TO OTHER INDIVIDUALS WITHOUT EXPRESS WRITTEN CONSENT  }
{   AND PERMISSION FROM DEVELOPER EXPRESS INC.                      }
{                                                                   }
{   CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON       }
{   ADDITIONAL RESTRICTIONS.                                        }
{                                                                   }
{*******************************************************************}
*/
#endregion Copyright (c) 2000-2008 Developer Express Inc.

using System;
using System.Windows.Controls;
using DevExpress.AgDataGrid.Data;
using System.Windows;
namespace DevExpress.AgDataGrid {
	public class DataGridRowEventArgsBase : EventArgs {
		DataController dataController;
		int rowHandle;
		public DataGridRowEventArgsBase(DataController dataController, int rowHandle) {
			this.dataController = dataController;
			this.rowHandle = rowHandle;
		}
		protected DataController DataController { get { return dataController; } }
		public int RowHandle { get { return rowHandle; } }
		public object DataRow {  get { return DataController.GetRowValue(RowHandle); }  }
		public bool IsRowValid { get { return DataController.IsValidControllerRowHandle(RowHandle); } }
		public bool IsRowGrouped { get { return IsRowValid && DataController.IsGroupRowHandle(RowHandle); } }
	}
	public class NewDataRowEventArgs : DataGridRowEventArgsBase {
		AgDataGridRow row;
		public NewDataRowEventArgs(DataController dataController, AgDataGridRow row) : base(dataController, row.Handle) {
			this.row = row;
		}
		public AgDataGridRow Row { get { return row; } }
	}
	public class MouseOverRowEventArgs : DataGridRowEventArgsBase {
		public MouseOverRowEventArgs(DataController dataController, int rowHandle) : base(dataController, rowHandle) {
		}
	}
	public class PreviewStatusEventArgs : DataGridRowEventArgsBase {
		bool isOpening;
		UIElement preview;
		public PreviewStatusEventArgs(DataController dataController, int rowHandle, bool isOpening, UIElement preview) : base(dataController, rowHandle) {
			this.isOpening = isOpening;
			this.preview = preview;
		}
		public bool IsOpening { get { return isOpening; } }
		public UIElement Preview { get { return preview; } }
	}
	public class EditingEventArgs : EventArgs {
		FrameworkElement editor;
		public EditingEventArgs(FrameworkElement editor, object value)	: this(editor) {
			Value = value;
		}
		public EditingEventArgs(FrameworkElement editor) {
			this.editor = editor;
		}
		public object Value { get; set; }
		public FrameworkElement Editor { get { return editor; } }
	}
	public class PrepareCellDisplayElementEventArgs : EventArgs {
		AgDataGridCellData cellData;
		FrameworkElement displayElement;
		public PrepareCellDisplayElementEventArgs(AgDataGridCellData cellData, FrameworkElement displayElement) {
			this.cellData = cellData;
			this.displayElement = displayElement;
		}
		public AgDataGridCellData CellData { get { return this.cellData; } }
		public FrameworkElement DisplayElement { get { return this.displayElement; } }
	}
	public class ShowLineEventArgs : EventArgs {
		object prevContent;
		object nextContent;
		public object PrevContent { get { return prevContent; } }
		public object NextContent { get { return nextContent; } }
		public bool ShowLine { get; set; }
		public ShowLineEventArgs(object prevContent, object nextContent) {
			this.prevContent = prevContent;
			this.nextContent = nextContent;
		}
	}
	public delegate void NewDataRowEventHandler(object sender, NewDataRowEventArgs e);
	public delegate void MouseOverRowEventHandler(object sender, MouseOverRowEventArgs e);
	public delegate void PreviewStatusEventHandler(object sender, PreviewStatusEventArgs e);
	public delegate void TemplateColumnValueEditingEventHandler(object sender, EditingEventArgs e);
	public delegate void PrepareCellDisplayElementEventHandler(object sender, PrepareCellDisplayElementEventArgs e);
	public delegate void ShowLineEventHandler(object sender, ShowLineEventArgs e);
}
